﻿using Business.Dto;
using Business.Service;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WoChu.Infrastructure.ModelCommmon;
using WoChu.Infrastructure.Web;
using WoChu.WMS.Application.Dto;
using WoChu.WMS.Entity;

namespace MvcAppWeb.Controllers
{
    public class LocationReportController : BaseDataController
    {
        /// <summary>
        /// 订单查漏
        /// </summary>
        /// <returns></returns>
        public ActionResult List()
        {
            var reprotType = Convert.ToInt32(Request["type"] ?? "1");
            if (reprotType < 1 || reprotType > 10)      //type是 1到 10的报表，(type=0 废弃）
            {
                reprotType = 1;
            }
            string title = ((LocationReportType)reprotType).ToString();
            ViewBag.Title = title;
            ViewBag.ReportType = reprotType;
            return View();
        }

        public ActionResult GetDataList(LocationReportInput input)
        {
            int page = int.Parse(Request["page"].ToString());
            int rows = int.Parse(Request["rows"].ToString());
            LocationReportService service = new LocationReportService();
            PageInfo<dynamic, LocationReportInput> pageInfo = new PageInfo<dynamic, LocationReportInput>()
            { 
                Condition=input,
                PageIndex = page, PageSize = rows
            };
            service.GetPageList(pageInfo);
            return Json(pageInfo);
        }
        /// <summary>
        /// 订单查漏列表查询
        /// </summary>
        /// <param name="checkOrderIn"></param>
        /// <returns></returns>
        public JsonResult GetCheckOrderList(CheckOrderInput checkOrderIn)
        {
            SaleAPPService service = new SaleAPPService();
            int page = int.Parse(Request["page"].ToString());
            int rows = int.Parse(Request["rows"].ToString());
            PageInfo<CheckOrder, CheckOrderInput> pageInfo = new PageInfo<CheckOrder, CheckOrderInput>() { Condition = checkOrderIn, PageIndex = page, PageSize = rows };
            service.GetCheckOrderList(pageInfo);
            return Json(pageInfo);
        }       
       
    }
}